<?php

/**
 * @name: raysession.class.php
 * @version: 1.0
 * @package: PHP MVC Framework
 * @uses: Handles all user session functions
 * @copyright: MIT
 * @author Andrew Lowther
 */

class RaySession {
	
	var $current_sessions = array();
	
	public function __construct() {
		
		session_start();
		
	}
	
	public function __set($session, $var) {
		
		array_push($this->current_sessions, $session);
		$_SESSION[$session] = $var;
		
	}
	
	public function destroy($session) {
		
		unset($this->current_sessions[$session]);
		unset($_SESSION[$session]);
		
	}
	
	public function close() {
		
		$this->current_sessions = array();
		session_destroy();
		
	}
	
	public function __get($session) {
		
		if (isset($_SESSION[$session])) {
		
			return $_SESSION[$session];
			
		} else {
			
			return false;
			
		}
		
	}
	
}

?>